package com.example.design.ddd.practice2.domain.Payment.entity;

import com.example.design.ddd.practice2.domain.Payment.PaymentStatus;
import com.example.design.ddd.practice2.domain.order.valueobject.Money;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * 支付聚合
 */
@Setter
@Getter
public class Payment {
    private String paymentId;
    private String orderId;
    private Money amount;
    private PaymentStatus status;
    private LocalDateTime paidTime;

    // 领域方法 - 验证支付有效性
    public boolean validate() {
        return status == PaymentStatus.SUCCESS && 
               paidTime != null && 
               amount != null;
    }
}
